package invoicesystem.util;



import invoicesystem.pojo.InvoicingApplyList;

import java.util.ArrayList;

public class PageHelper {

    private Integer showData=3;//每页显示几条数据，默认3条
    private Integer countData;//一共有多少条数据参与分页。 查数据库
    private Integer countPage;// 一共能分多少页
    private Integer indexPage=1;// 当前是第几页，默认当前是第1页
    private ArrayList<InvoicingApplyList> list;//当前页显示的集合数据，查数据库

    public PageHelper() {
    }

    public PageHelper(Integer showData, Integer countData, Integer countPage, Integer indexPage, ArrayList<InvoicingApplyList> list) {
        this.showData = showData;
        this.countData = countData;
        this.countPage = countPage;
        this.indexPage = indexPage;
        this.list = list;
    }

    public Integer getShowData() {
        return showData;
    }

    public void setShowData(Integer showData) {
        this.showData = showData;
    }

    public Integer getCountData() {
        return countData;
    }

    public void setCountData(Integer countData) {
        this.countData = countData;
        //当给总条数赋值后，立刻就知道总页数
        getCountPage();
    }

    public Integer getCountPage() {
        countPage=countData%showData==0?
                countData/showData:
                countData/showData+1;
        return countPage;
    }

  /*  public void setCountPage(Integer countPage) {
        this.countPage = countPage;
    }*/

    public Integer getIndexPage() {
        return indexPage;
    }

    public void setIndexPage(Integer indexPage) {
        this.indexPage = indexPage;
    }

    public ArrayList<InvoicingApplyList> getList() {
        return list;
    }

    public void setList(ArrayList<InvoicingApplyList> list) {
        this.list = list;
    }
}
